<?php


namespace app\common\OutPay;


use App\Models\PayExchange\ExchangeListModel;
use App\Models\TransactionListModel;

class Base
{
    protected $err = '';

    protected $config;

    public function __construct(array $config)
    {
        $this->config = $config;
    }

    /**
     * @return string
     */
    public function getErr()
    {
        return $this->err;
    }

    /**
     * @param string $orderNo
     * @return ExchangeListModel|false
     */
    public function orderInfo(string $orderNo) {
        $order = ExchangeListModel::query()->where('order_no', $orderNo)->first();
        if (!($order instanceof ExchangeListModel)) {
            $this->err = '订单未找到';
            return false;
        }
        if ($order->status != ExchangeListModel::STATUS_PLAYING) {
            $this->err = '订单状态非法';
            return false;
        }
        return $order;
    }



}